set(xdgiconloader_PUBLIC_H_FILES
)

set(xdgiconloader_PUBLIC_CLASSES
)

set(xdgiconloader_PRIVATE_H_FILES
)

set(xdgiconloader_CPP_FILES
    xdgiconloader.cpp
)

set(xdgiconloader_PRIVATE_INSTALLABLE_H_FILES
    xdgiconloader_p.h
)


add_library(${QTXDGX_ICONLOADER_LIBRARY_NAME} SHARED
    ${xdgiconloader_CPP_FILES}
    ${xdgiconloader_PRIVATE_INSTALLABLE_H_FILES}
)

generate_export_header(${QTXDGX_ICONLOADER_LIBRARY_NAME} BASE_NAME XdgIconLoader)

# Copy public headers (in tree building)
set(XDGICONLOADER_EXPORT_FILE "xdgiconloader_export.h")
configure_file(
    "${CMAKE_CURRENT_BINARY_DIR}/${XDGICONLOADER_EXPORT_FILE}"
    "${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${XDGICONLOADER_EXPORT_FILE}"
    COPYONLY
)

target_compile_definitions(${QTXDGX_ICONLOADER_LIBRARY_NAME}
    PRIVATE
        "QT_NO_KEYWORDS"
)

target_include_directories(${QTXDGX_ICONLOADER_LIBRARY_NAME}
    INTERFACE
        "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}>"
        "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
        "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}>"
    PUBLIC
        "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}>"
        "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}>"
        "$<BUILD_INTERFACE:${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}>"
    PRIVATE
        ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
)

target_link_libraries(${QTXDGX_ICONLOADER_LIBRARY_NAME}
    PUBLIC
        Qt5::Gui
        Qt5::Svg
)

set_target_properties(${QTXDGX_ICONLOADER_LIBRARY_NAME}
    PROPERTIES
        VERSION   ${QTXDG_VERSION_STRING}
        SOVERSION ${QTXDG_MAJOR_VERSION}
)

add_subdirectory(plugin)

install(TARGETS
    ${QTXDGX_ICONLOADER_LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}"
    EXPORT "${QTXDGX_ICONLOADER_FILE_NAME}-targets"
    COMPONENT Runtime
)

install(FILES
    ${xdgiconloader_PRIVATE_INSTALLABLE_H_FILES}
    DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}/private/xdgiconloader"
    COMPONENT Devel
)

file(COPY
    ${xdgiconloader_PRIVATE_INSTALLABLE_H_FILES}
    DESTINATION "${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${QTXDG_VERSION_STRING}/private/xdgiconloader"
)

install(FILES
    "${QTXDGX_INTREE_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}/${XDGICONLOADER_EXPORT_FILE}"
    DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${QTXDGX_ICONLOADER_FILE_NAME}"
)
